Today's communication devices are generally specialized computing devices, that include such elements as a microprocessor, an operating system, software applications, and other such computational resources. These devices process communication signals in a real time or near real time manner, and thus computational resources must be configured to perform well in this environment. In a typical portable communication device, constraints are imposed by size, power consumption, and cost considerations, that limit how computational and other resources are used within the device. One such resource that must be managed carefully is that of physical memory. The total memory requirements for applications may far exceed the available physical memory, and thus applications tend to share the available physical memory.
The operating system is a program that manages the use of computational resources, such as memory, and other devices. When memory is required by a particular application, the operating system utilizes memory management techniques to allocate memory as needed to the particular application. In one method of memory allocation, the available memory is divided up into pools of fixed length memory buffers. When an application requests memory from the operating system, a memory buffer of an appropriate size is selected from one of the memory buffer pools and allocated to that particular application. When that memory buffer is no longer needed by the application, it is released and made available for subsequent use by that or another application. By organizing the available memory into pools of different size memory buffers, an efficient memory allocation scheme can be maintained that avoids problems such as fragmentation of memory.
Fixed length allocation methods have the advantage of having no memory fragmentation and hence does not require a garbage collection or other similar memory recovery techniques required for variable length allocation methods. As memory recovery can take substantial time and delay operation of certain critical applications, fixed buffer allocation methods are more commonly found in real time operating systems. However, one problem with the use of a fixed size buffer allocation scheme, is that of determining the proper configuration for such memory buffers.
In a typical memory buffer configuration, each pool holds memory buffers of a particular size, and there may be several pools for different memory buffer sizes. For example, a first pool may hold twenty buffers of size one hundred bytes, a second pool may hold ten buffers of size two hundred bytes, a third pool may hold five buffers of size five hundred bytes, and so on. Optimal configuration of the number of buffers in each pool and the buffer size for each pool is difficult to determine and depends on the particular mix of applications executed in a given environment.
The prior art describes a variety of methods in an attempt to address the problem of determining the optimum configuration for fixed size buffer memory allocation. One example is described in U.S. Pat. No. 5,568,635 issued to Yamaguchi on Oct. 22, 1996, for a PHYSICAL MEMORY ALLOCATION SYSTEM, PROGRAM EXECUTION SCHEDULING SYSTEM AND INFORMATION PROCESSOR. In Yamaguchi, a program is run for a fixed period of time so as to determine the memory requirements for the program. The memory requirements so determined are used when executing the program to improve the efficiency of physical memory allocation. In a second example described in U.S. Pat. No. 5,640,604, issued to Hirano on Jun. 17, 1977, for a BUFFER REALLOCATION SYSTEM, buffer allocation to a program is monitored so that a re-allocation of memory is performed when the number of available buffers is smaller than a pre-determined threshold. In a third example described in U.S. Pat. No. 5,093,912, issued to Dong et al. on Mar. 3, 1992, for DYNAMIC RESOURCE POOL EXPANSION AND CONTRACTION IN MULTIPROCESSING ENVIRONMENTS, resources, such as memory, are allocated for use from a single master pool. The overall pool of available resources is expanded by creating an extension pool and by adding its resources to the master pool. A fourth example is described in U.S. Pat. No. 5,491,808, issued to Geist Jr. on Feb. 13, 1996, for a METHOD FOR TRACKING MEMORY ALLOCATION IN NETWORK FILES SERVER. Here, memory resource allocations and deallocations for a program resident in memory are tracked, and a report generated as to what memory allocations remain unfreed and what, if any, unusual events have occurred in the memory management process. This is done by logging the memory allocation and release calls to the system. Events of allocations without a subsequent release, or releases without a prior allocation are noted for attention by a programmer.
The above mentioned prior art schemes do not adequately address efficiency needs in physical memory allocation for a real time operating system that has to operate with limited memory resources. It is desirable to have a memory management scheme that can better respond to the memory allocation needs of a particular operating environment. Therefore, a new memory buffer management method and apparatus is needed.